<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>添加测试计划</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" media="all"/>
    <style type="text/css">
        .input-my{
            width: 300px;
        }
        #main label{
            width: 120px;
        }
    </style>
</head>
<body>
<div th:replace="header::header"></div>
<hr/>
<div id="main">
    <!--/*@thymesVar id="tp" type="com.wangc.test_plan.bean.TestPlanBean"*/-->
    <form class="layui-form" th:action="@{/tp/upload}" th:id="add_form" th:enctype="@{multipart/form-data}" th:object="${tp}"
          th:method="post">
        <div class="layui-form-item">
            <label class="layui-form-label">测试计划名称</label>
            <div class="layui-input-block">
                <input type="text" name="tpName" required="required" lay-verify="required" placeholder="请输入标题" autocomplete="off"
                       class="layui-input input-my"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">测试描述</label>
            <div class="layui-input-block">
                <input type="text" name="description" required="required" lay-verify="required" placeholder="请输入标题" autocomplete="off"
                       class="layui-input input-my"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">上传脚本文件</label>
            <div class="layui-input-block" style="padding: 9px 15px;">
                <input th:type="file" th:name="file" class="layui-btn layui-btn-mini" style="background-color: #ffffff;"/>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="submit" name="submit" class="layui-btn layui-btn-primary"/>
            </div>
        </div>

    </form>
</div>

<!--/*@thymesVar id="tp" type="com.wangc.test_plan.bean.TestPlanBean"*/-->


<script th:src="@{/js/jquery-1.12.3.min.js}"></script>
<script th:src="@{/layer/layer.js}"></script>
<script language="javascript">
    $(document).ready(function () {
        layui.use('form', function () {

        });

        var handInputDiv = $("#handInputDiv");
        var uploadFileDiv = $("#uploadFileDiv");
        //todo 应该根据radio的选中状态，而不是根据click来判断
        $("input[name='inputType']").bind('click', function () {
            var this_val = $(this).val();

            if ('0' === this_val) {//手工录入
                handInputDiv.show();
                uploadFileDiv.hide();
            } else if ('1' === this_val) {//上传jmx
                handInputDiv.hide();
                uploadFileDiv.show();
            }
        });
    });
</script>
</body>
</html>